<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">

<head>
    <div data-th-replace="layout/head-top"></div>
</head>
<body>
    <div class="wrapper animated fadeInLeft">
        <div class="row">
            <div>
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>订单信息 <small class="m-l-sm">（价格、订单号、金额、时间等信息）</small></h5>
                        </div>
                        <div class="ibox-content p-xl">
                            <div class="row">
                                <div class="col-sm-12 text-left">
                                    <p>
                                    <strong>订单号：</strong>
                                    <samp class="text-navy" th:text="${order['orderNo']}"></samp>
                                    <strong>第三方流水号：</strong>
                                    <samp class="text-navy" th:text="${#strings.isEmpty(order['externalOrderNo'])}?'无':${order['externalOrderNo']}"></samp>
                                    </p>
                                    <p>
                                    <strong>下单用户：</strong>
                                    <strong class="text-navy">
                                        <samp data-toggle="tooltip" data-placement="bottom" data-original-title="手机号">
                                            <samp th:if="!${#strings.isEmpty(order['user']['mobile'])}" th:text="${order['user']['mobile']}"></samp>
                                            <samp th:if="${#strings.isEmpty(order['user']['mobile'])}">—</samp>
                                        </samp>/
                                        <samp data-toggle="tooltip" data-placement="bottom" data-original-title="邮箱号">
                                            <samp th:if="!${#strings.isEmpty(order['user']['email'])}" th:text="${order['user']['email']}"></samp>
                                            <samp th:if="${#strings.isEmpty(order['user']['email'])}">—</samp>
                                        </samp>/
                                        <samp data-toggle="tooltip" data-placement="bottom" data-original-title="账号">
                                            <samp th:if="!${#strings.isEmpty(order['user']['loginAccount'])}" th:text="${order['user']['loginAccount']}"></samp>
                                            <samp th:if="${#strings.isEmpty(order['user']['loginAccount'])}">—</samp>
                                        </samp>/
                                        <samp data-toggle="tooltip" data-placement="bottom" data-original-title="昵称">
                                            <samp th:if="!${#strings.isEmpty(order['user']['nickname'])}" th:text="${order['user']['nickname']}"></samp>
                                            <samp th:if="${#strings.isEmpty(order['user']['nickname'])}">—</samp>
                                        </samp>
                                    </strong>
                                    </p>
                                </div>
                                <div class="col-sm-12 text-right">
                                    <address th:if="${#strings.contains(order['sellTypeList'],',BOOK,')}">
                                        <strong th:text="'收货人'+${order['orderBook']['addressMap']['userName']}"></strong><br>
                                        <strong title="Phone" th:text="'收货地址：'+${order['orderBook']['addressMap']['address']}"></strong> &nbsp;&nbsp;
                                        <strong title="Phone" th:text="'电话：'+${order['orderBook']['addressMap']['mobile']}"></strong>&nbsp;&nbsp;
                                        <strong title="Phone" th:text="'邮政编号：'+${order['orderBook']['addressMap']['postCode']}"></strong><br/>
                                        <span>
                                            <strong>是否发货：</strong>
                                            <samp th:if="${order['orderBook']['mailStatus']}==2">已发货</samp>
                                            <samp th:if="${order['orderBook']['mailStatus']}!=2">未发货</samp>
                                        </span><br/>
                                        <span th:if="${order['orderBook']['mailStatus']}==2">
                                            <span><strong>物流公司名：</strong>
                                                <samp th:text="${order['orderBook']['mailName']}"></samp>
                                            </span><br/>
                                            <span><strong>货运编号：</strong>
                                                <samp th:text="${order['orderBook']['mailCode']}"></samp>
                                            </span><br/>
                                            <span><strong>是否签收：</strong>
                                                <samp th:if="${order['orderBook']['signStatus']}==2">已签收</samp>
                                                <samp th:if="${order['orderBook']['signStatus']}!=2">未签收</samp>
                                            </span>
                                        </span>
                                    </address>
                                    <p>
                                        <span th:if="${order['orderStatus']}=='INIT'" class="text-navy"><strong>状态：</strong>未支付</span>
                                        <span th:if="${order['orderStatus']}=='SUCCESS'"><strong>状态：</strong>已支付</span>
                                        <span th:if="${order['orderStatus']}=='REFUND'" class="text-navy"><strong>状态：</strong>已退款</span>
                                        <span th:if="${order['orderStatus']}=='CANCEL'" class="text-navy"><strong>状态：</strong>已取消</span><br/>
                                        <span><strong>下单时间：</strong>
                                            <samp th:text="${#strings.substring(order['createTime'],0,16)}"></samp>
                                        </span><br/>
                                        <span><strong>支付时间：</strong>
                                            <samp th:text="${#strings.isEmpty(order['payTime'])}?'—':${#strings.substring(order['payTime'],0,16)}"></samp>
                                        </span>
                                    </p>
                                </div>
                            </div>
                            <div class="table-responsive m-t">
                                <table class="table invoice-table">
                                    <thead>
                                        <tr>
                                            <th>清单</th>
                                            <th>数量</th>
                                            <th>原价</th>
                                            <th>优惠</th>
                                            <th>活动</th>
                                            <th>金额</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr th:each="details : ${order['orderDetailsList']}">
                                            <td>
                                                <div>
                                                    <strong>
                                                        <samp th:if="${details['shopType']}=='COURSE'" th:text="${details['shop']['course']['courseName']}+'[课程]'"></samp>
                                                        <samp th:if="${details['shopType']}=='BOOK'" th:text="${details['shop']['book']['bookName']}+'[图书]'"></samp>
                                                        <samp th:if="${details['shopType']}=='MEMBER'" th:text="${details['shop']['member']['memberName']}+'[会员]'"></samp>
                                                        <samp th:if="${details['shopType']}=='ACCOUNT'">账户充值</samp>
                                                        <samp th:if="${details['shopType']}=='QA'" th:text="${#strings.abbreviate(details['shop']['qa']['context'],15)+'[问答]'}"></samp>
                                                        <samp th:if="${details['shopType']}=='ATTEND'" th:text="${#strings.abbreviate(details['shop']['qa']['context'],15)+'[旁听]'}"></samp>
                                                        <samp th:if="${details['shopType']}=='EXAM'" th:text="${details['shop']['exam']['name']}+'[试卷]'"></samp>
                                                    </strong>
                                                </div>
                                            </td>
                                            <td th:text="${details['buyNum']}"></td>
                                            <td><i class="fa fa-rmb"></i><samp th:text="${details['price']}"></samp></td>
                                            <td>-<i class="fa fa-rmb"></i><samp th:text="${details['yhPrice']}"></samp></td>
                                            <td>-<i class="fa fa-rmb"></i><samp th:text="${details['activityPrice']}"></samp></td>
                                            <td><i class="fa fa-rmb"></i><samp th:text="${details['realPrice']}"></samp></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <!-- /table-responsive -->
                            <table class="table invoice-total">
                                <tbody>
                                    <tr>
                                        <td><strong>实付金额：</strong>
                                        </td>
                                        <td><i class="fa fa-rmb"></i>
                                            <samp th:text="${order['realPrice']}"></samp>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td><strong>总优惠：</strong>
                                        </td>
                                        <td>- <i class="fa fa-rmb"></i>
                                            <samp th:text="${order['yhPrice']}+${order['activityPrice']}+${order['memberSubPrice']}"></samp>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td><strong>总计</strong>
                                        </td>
                                        <td><i class="fa fa-rmb"></i>
                                            <samp th:text="${order['realPrice']}"></samp>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <div class="text-right">
                                <button class="btn btn-default" id="printPageBtn"><i class="fa fa-print"></i> 打印单据</button>
                            </div>
                            <div class="well m-t">
                                <strong>其它信息：</strong> 打印订单只是需要自己的单据，不提供法理依据。
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div data-th-replace="layout/head-footer"></div>
    <script>
        $(function() {
            $('body').on('click', '#printPageBtn', function() {
                window.print();
            });
        });
    </script>
</body>
</html>
